package com.lfxfs.controller;

import com.lfxfs.mapper.SchemasMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/schame")
@Api("测试")
@Slf4j
public class SchameController {
    @Autowired
    private SchemasMapper schemasMapper;

    @GetMapping("showTableComment")
    @ApiOperation("测试-查表概况")
    public Map queryComments(String tableName){
       return schemasMapper.showTableComment(tableName);
    }

    @GetMapping("showFullColumns")
    @ApiOperation("测试-查表行")
    public List<Map<String, String>> showFullColumns(String tableName){
        return schemasMapper.showFullColumns(tableName);
    }

    @GetMapping("selectTable")
    @ApiOperation("测试-查表")
    public List<Map<String, Object>> select(String tableName,String sqlWhere,String orderBy){
        log.info("inParam:{},{},{},{}",tableName,"*",sqlWhere,orderBy);
        return schemasMapper.select(tableName,"*",sqlWhere,orderBy);
    }
}
